clear all
set more off, perm

/* define global parameters and paths */

/* paths */
global basepath "M:\Massachusetts"      
global basepath2 "M:\Massachusetts\projects\charter_heterogeneity"      
global basepath3 "M:\Massachusetts\data_setup"      

cd "$basepath"

global raw "$basepath\data_raw" 
global data "$basepath2\data" 
global data_clean "$basepath\data_clean" 

* added by Astrid to include data on IPEDS graduation rates, Barron's ranking, 
* and social networks

* pulling and saving IPEDS data

educationdata using "college ipeds grad-rates", sub(year=2012) clear
	keep if race == 99 & sex == 99 & subcohort == 99
	drop race sex subcohort institution_level
 	rename * *_ip
	rename unitid_ip unitid
	tempfile tempA
	save `tempA'

educationdata using "college ipeds institutional-characteristics", sub(year=2012)  clear
	keep unitid academic_counseling remedial_services  
	rename * *_ip
	rename unitid_ip unitid
	merge 1:1 unitid using `tempA'
	drop _merge
	tempfile tempB
	save `tempB'
	
educationdata using "college ipeds finance", sub(year=2012) clear
	keep unitid exp_instruc_total exp_acad_supp_total exp_student_serv_total exp_inst_supp_total 
	rename * *_ip
	rename unitid_ip unitid
	merge 1:1 unitid using `tempB'
	drop _merge
	tempfile tempC
	save `tempC'
	
educationdata using "college ipeds student-faculty-ratio", sub(year=2012) clear
	keep unitid student_faculty_ratio 
	rename * *_ip
	rename unitid_ip unitid
	merge 1:1 unitid using `tempC'
	drop _merge
	
	save "$data_clean\ipeds_data", replace

	